package com.cjx.yuanshenstartforumbackend.exception;

import com.cjx.yuanshenstartforumbackend.common.ErrorCode;
import lombok.Getter;

/**
 * @Description 自定义异常类
 * @Author cjx
 * @Date 2023/12/21 15:01
 **/
@Getter
public class MyException extends RuntimeException{
    private int code;
    private String description;
    public MyException(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public MyException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.description = errorCode.getMessage();
    }

    public MyException(ErrorCode errorCode, String description) {
        this.code = errorCode.getCode();
        this.description = description;
    }

    public MyException() {
    }
}
